<template>
    <div class="container">
        <el-progress :percentage="percentage" :stroke-width="propJson.strokeWidth"
                     :striped="propJson.isStriped" :type="propJson.type"
                     :text-inside="propJson.isTextInside" :indeterminate="propJson.isIndeterminate"
                     :width="propJson.width" :show-text="propJson.isShowText" :striped-flow="propJson.stripedFlow"
                     :duration="propJson.duration" :ywuInfo="execPercentage"/>
    </div>
</template>

<script name="PercentageComponent" lang="ts" setup>
import {doThirdServiceValue} from "@/utils/lowcode/thirdService";
import {computed, defineProps, ref} from "vue";

let props = defineProps(['propJson', 'commonParam']);

let propJson = computed(() => {return props['propJson']})
let commonParam = computed(() => {return props['commonParam']})

let percentage = ref(0);

let execPercentage = computed(async () => {
    if (propJson.value.editFlag) {
        return;
    }
    await doThirdServiceValue(propJson.value.actionInfo, commonParam.value, execThen, execCatch, null)
})

function execThen(resValue, param) {
    percentage.value = parseInt(resValue);
}

function execCatch(resValue) {

}
</script>

<style scoped lang="less">

</style>